package com.chatcompetition.controller;


import com.chatcompetition.domain.entity.UmsMenu;

import com.chatcompetition.service.UmsMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menu")
public class UmsMenuController {

    @Autowired
    private UmsMenuService umsMenuService;

    /**
     * 根据 level 查询菜单的 title
     * @param level 菜单级数
     * @return 符合条件的菜单 title 列表
     */
    @GetMapping("/titles")
    public List<String> getMenuTitlesByLevel(@RequestParam int level) {
        return umsMenuService.getMenuTitlesByLevel(level);
    }
}